import { PositionComponent } from "../component/PositionComponent";
import { GameWorld } from "../world/World";
import { SystemBase } from "./SystemBase";

//移动

export class MoveSystem extends SystemBase {
    constructor(world: GameWorld) {
        super(world);
    }
    Add(position: PositionComponent) {
        this.world.positionList.DelayAdd(position);
    }

    Remove(position: PositionComponent) {
        this.world.positionList.DelayRemove(position);
    }

    Update(position: PositionComponent) {
        const go = position.entity.gameObject.mesh;
        go.position.copy(position.value);
        // console.log(go.uuid, go.position);
    }
}
